<template>
  <div class="app-container">
    <el-table :data="dataList" border @sort-change="sortChange" >
      <el-table-column prop="serialNO" width="50" label="序号" align="center"/>
      <el-table-column prop="userName" label="用户名" width="200"/>
      <el-table-column prop="userRandomId" label="用户UID" width="180"/>
      <el-table-column prop="realAmount" sortable="custom" label="充值金额" width="220">
        <template slot-scope="scope">
          <span>{{ '$' + $yun.formatAmount(scope.row.realAmount)}}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>

import {rwranking} from "@/api/statement/rechargeReport";

export default {
  data() {
    return {
      dataList: [],
      loading: false,
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: 're',
        sort:'DESC',//ASC
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    sortChange( column, prop, order){
      if(this.sort == 'DESC'){
        this.sort = 'ASC'
      }else{
        this.sort = 'DESC'
      }
      console.log(this.sort);
      this.getList();

    },
    getList() {
      this.loading = true
      this.queryParams.sort = this.sort
      rwranking(this.queryParams).then(response => {
        this.dataList = response.data.records
        this.total = response.data.total
        this.loading = false
      })
    },
  },
}
</script>
